﻿@using WebBaseFrame.Models
@using System.Data;
@using Libraries;
@{
    Layout = null;
    var optionNames = ViewData["optionNames"] as List<string>;
}
<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="Content-Language" content="zh-cn" />
    <meta name="author" content="R&D yswenli" />
    <meta name="copyright" content="Copyright yswenli All Rights Reserved." />
    <meta name="robots" content="all" />
    <meta name="keywords" content="@(ViewBag.KeyWords != null ? ViewBag.KeyWords : Libraries.CurrentSite.KeyWords)">
    <meta name="description" content="@(ViewBag.Description != null ? ViewBag.Description : Libraries.CurrentSite.Description)" />
    <title>@(ViewBag.Title == null ? "" : ViewBag.Title + " | ")@Libraries.CurrentSite.Title</title>
    <link href="~/Areas/Admin/Content/js/select2/select2.css" rel="stylesheet" />
    <link href="~/Areas/Admin/Content/icons/icons.css" rel="stylesheet" />
    <link href="~/Areas/Admin/Content/js/bootstrap/css/bootstrap.css" rel="stylesheet" />
    <link href="~/Areas/Admin/Content/css.css" rel="stylesheet" />
    <link href="~/Areas/Admin/Content/ie6_7.css" rel="stylesheet" />
    <script src="~/Areas/Admin/Content/js/jquery.min.js"></script>
    <script src="~/Areas/Admin/Content/js/bootstrap/js/bootstrap.min.js"></script>
    <!--[if lt IE 9]><script src="/areas/admin/content/js/html5shiv.js?body=1"></script><![endif]-->
    <script src="~/Areas/Admin/Content/js/kindeditor-4.1.9/kindeditor.js"></script>
    <script src="~/Areas/Admin/Content/js/kindeditor-4.1.9/plugins/code/prettify.js"></script>
    <script src="~/Areas/Admin/Content/js/kindeditor-4.1.9/lang/zh_CN.js"></script>
    <script src="~/Areas/Admin/Content/js/artDialog/jquery.artDialog.js?skin=default"></script>
    <script src="~/Areas/Admin/Content/js/artDialog/plugins/iframeTools.source.js"></script>
    <script src="~/Areas/Admin/Content/js/sidebar.js"></script>
    <script src="~/Areas/Admin/Content/js/scripts.js"></script>
    <script type="text/javascript">
        $(function () {
            function windowW() {
                if ($(window).width() < 980) {
                    $('#header').css('width', 980 + 'px');
                    $('.rightMain').css('width', 980 + 'px');
                    $('body').attr('scroll', '');
                    $('body').css('overflow', '');
                }
            }
            windowW();
            $(window).resize(function () {
                if ($(window).width() < 980) {
                    windowW();
                } else {
                    $('#header').css('width', 'auto');
                    $('.rightMain').css('width', 'auto');
                    $('body').attr('scroll', 'no');
                    $('body').css('overflow', 'hidden');
                }
            });
            window.onresize = function () {
                var heights = document.documentElement.clientHeight - 100;
                document.getElementById('rightMain').height = heights;
                var openClose = $("#rightMain").height();
            }
            window.onresize();

            $("#Open_Close").click(function () {
                $(this).attr("class", "");
                if ($("#td_leftMain").css("display") == "none") {
                    $("#td_leftMain").toggle('slow');
                    $(this).addClass("icos-go-full-screen");
                } else {
                    $("#td_leftMain").toggle('slow');
                    $(this).addClass("icos-go-back-from-full-screen");

                }
            });

            if ($("#rightMain").attr("src") == "") {
                var a_first = $("#sidemenu li:first a");
                a_first.trigger("click");
                $("#rightMain").attr("src", a_first.attr("href"));
            }
        });
    </script>
</head>
<body onbeforeunload="window.event.returnValue='';">
    <header class="row-fluid" id="header">
        <div class="span4">
            <h1>@Libraries.CurrentSite.Title</h1>
        </div>
        <div class="span8 right-link">
            <div class="header-functions">
                <dl style="position: relative; top: -5px;">
                    <dt>欢迎您<span class="name">@Libraries.CurrentMember.Member.RealName</span></dt>
                    <dd>
                        <div class="dropdown">
                            <a href="javascript:void(0);" class="dropdown-toggle" data-toggle="dropdown">
                                <img src="@Libraries.MemberHelper.Avatar(Libraries.CurrentMember.ID)" style="width:50px;height:50px;"></a>
                            <ul class="dropdown-menu pull-right">
                                <li><a href="/admin/account/personal" target="rightMain"><i class="icol-user"></i>账户信息</a></li>
                                <li><a href="/admin/account/personal?op=3" target="rightMain"><i class="icol-key"></i>修改密码</a></li>
                                <li class="divider"></li>
                                <li><a href="/admin/account/logout"><i class="icol-lock"></i>注销</a></li>
                            </ul>
                        </div>
                    </dd>
                </dl>
                <div class="exit ">
                    <a href="/admin/account/logout"><i class="icon-off icon-white"></i></a>
                </div>
            </div>
        </div>
    </header>
    <div class="main">
        <a href="javascript:void(0);" id="Open_Close" class="icos-go-full-screen" title="展开/收缩"></a>
        <table width="100%" border="0" cellpadding="0" cellspacing="0">
            <tr>
                <td id="td_leftMain" style="background: #fcfcfc; vertical-align: top; border-right: 1px solid #ccc; width: 180px;">
                    <div class="leftMain">
                        <!--左侧导航开始-->
                        <div id="sidemenu">
                            @foreach (var item in (new MenuRepository().Search().Where(b=>b.ParentID==0).OrderBy(b => b.Sort).ToList()))
                            {
                                if (Libraries.CurrentMember.RoleID == 1 || optionNames.Contains(item.Name) || Libraries.SiteHelper.Default.IsValidePermission != true)
                                {
                                    PermissionMapRepository.AddMenuPermissionMap(item.ID);
                                <dl>
                                    <dt><a href="javascript:void(0);"><i class="icon-chevron-down arrow-icon"></i><i class="@item.Icon"></i>@item.Name</a></dt>
                                    <dd>
                                        <ul>
                                            @foreach (var item2 in (new MenuRepository().Search().Where(b=>b.ParentID==item.ID).OrderBy(b => b.Sort).ToList()))
                                            {
                                                if (Libraries.CurrentMember.RoleID == 1 || optionNames.Contains(item2.Name) || Libraries.SiteHelper.Default.IsValidePermission != true)
                                                {
                                                    PermissionMapRepository.AddMenuPermissionMap(item2.ID);
                                                <li><a href="@item2.Url" target="rightMain"><i class="@item2.Icon"></i>@item2.Name</a>
                                                    <ul>
                                                        @foreach (var item3 in (new MenuRepository().Search().Where(b => b.ParentID == item2.ID).OrderBy(b => b.Sort).ToList()))
                                                        {
                                                            if (Libraries.CurrentMember.RoleID == 1 || optionNames.Contains(item3.Name) || Libraries.SiteHelper.Default.IsValidePermission != true)
                                                            {
                                                                PermissionMapRepository.AddMenuPermissionMap(item3.ID);
                                                            <li><a href="@item3.Url" target="rightMain" style="padding-left:40px;"><i class="@item3.Icon"></i>@item3.Name</a></li>
                                                            }
                                                        }
                                                    </ul>
                                                </li>
                                                }
                                            }
                                        </ul>
                                    </dd>
                                </dl>
                                }
                            }

                        </div>
                        <!--左侧导航结束-->
                    </div>
                </td>
                <td valign="top">
                    <!--右侧主体内容开始-->
                    <div class="rightMain">
                        <iframe name="rightMain" id="rightMain" src="" frameborder="false" scrolling="auto"
                            style="overflow-x: hidden; border: none;" width="100%" height="auto" allowtransparency="true"></iframe>
                    </div>
                    <!--右侧主体内容结束-->
                </td>
            </tr>
        </table>
        <div class="clearfix">
        </div>
    </div>
    <footer id="footer">
        WebBaseFrame 2013 - @DateTime.Now.Year Develop By yswenli
    </footer>
</body>
</html>
